﻿''' <summary>
''' 这个类的目的是临时浏览主窗口中的一些东西，设定对应的坐标
''' </summary>
''' <remarks></remarks>
Public Class PreViewManager

    Dim mapwin As AxMapWinGIS.AxMap
    Public Sub New(ByRef win As AxMapWinGIS.AxMap)
        mapwin = win

        mapwin.SendMouseDown = True
        mapwin.SendMouseMove = True
        mapwin.SendMouseMove = True
        mapwin.SendMouseUp = True
        mapwin.SendSelectBoxFinal = True


        mapwin.CursorMode = MapWinGIS.tkCursorMode.cmNone


    End Sub

    ''' <summary>
    ''' 需要显示的层的名称
    ''' </summary>
    ''' <remarks></remarks>
    Dim lst As New List(Of String)


    Public Sub AddPreViewLayerName(ByVal lname As String)

        lst.Add(lname)

    End Sub


    Dim dic As New Dictionary(Of String, Layer)
    Public Sub StartToView(ByRef layerm As LayerManager)
        mapwin.RemoveAllLayers()

        dic = layerm.GetLayersCopy()
        For Each kv As KeyValuePair(Of String, Layer) In dic

            Dim obj As Object

            '需要预览的层
            If lst.Contains(kv.Key) Then

                obj = kv.Value.GetObject()

                mapwin.AddLayer(obj, True)

            End If

           
        Next



    End Sub

    ''' <summary>
    ''' 全部层都显示的一面
    ''' </summary>
    ''' <param name="layerm"></param>
    ''' <remarks></remarks>
    Public Sub StartToViewWithNoStrict(ByRef layerm As LayerManager)

        mapwin.RemoveAllLayers()

        dic = layerm.GetLayersCopy()
        For Each kv As KeyValuePair(Of String, Layer) In dic

            Dim obj As Object

            '需要预览的层


            obj = kv.Value.GetObject()

            mapwin.AddLayer(obj, True)




        Next

    End Sub


End Class
